package com.link2room.rodimus.service;

import com.link2room.common.dao.ICommonDao;
import com.link2room.common.jpa.criteria.CriteriaUtil;
import com.link2room.rodimus.dto.result.base.DrawPrizeBaseDto;
import com.link2room.rodimus.entity.CouponConsumeBaseEntity;
import com.link2room.rodimus.entity.CouponConsumeDetailEntity;
import com.link2room.rodimus.entity.Demo;
import com.link2room.rodimus.entity.DrawPrizeBaseEntity;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * Created by sss on 2016/9/20.
 */
@Component("testService2")
public class Test2 {
    @Resource
    private ICommonDao commonDao;

    @Transactional
    public void m2(String rateId) throws Exception {
        CouponConsumeBaseEntity find = new CouponConsumeBaseEntity();

        find.setId(229L);

        CouponConsumeBaseEntity res = commonDao.findOne(CouponConsumeBaseEntity.class, CriteriaUtil.getCriteriaAllEQ(find));
        res.setAmount(res.getAmount() + 1);
        commonDao.merge(res);
    }
}
